package net.qiyuesuo.utils.file;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class FileUtils {

	/**
	 * 获取指定路径文件数据
	 * @param filePath
	 * @return
	 */
	public static String getContentByPath(String filePath) {
		File file = new File(filePath);    
        String result = "";
        try (InputStream is = new FileInputStream(file)){
            int len = 0;
            byte[] buf = new byte[1024];
            while((len = is.read(buf))!= -1) {   
                result = result+new String(buf,0,len);    ;
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
		return result;
	}
	
}
